﻿using System;
using System.Linq;

namespace HW_d2
{
    class Program
    {

        static void Main(string[] args)
        {
            Random random = new Random();
            int[] a = new int[100];
            for (int i = 0; i < 100; i++)
            {
                a[i] = random.Next(1001);
            }
            Console.WriteLine("原数组为：");
            foreach (int b in a)
                Console.Write(" " + b);
            Console.WriteLine();
            var query1 = from s in a
                         orderby s descending
                         select s;
            int sum = query1.Sum(s => s);
            double average = query1.Average(s => s);
            Console.WriteLine("排序后数组为：");
            foreach (int b in query1)
                Console.Write(" " + b);
            Console.WriteLine();
            Console.WriteLine("和为：" + sum);
            Console.WriteLine("平均数为：" + average);


        }
    }
}